package cn.ccit.servers;

import java.util.List;

import cn.ccit.DAO.DiningTableDAO;
import cn.ccit.DAOImp.DiningTableDAOimp;
import cn.ccit.base.BaseConstants;
import cn.ccit.entites.DiningTable;
import cn.ccit.iservers.IDiningTableServers;
/**
 * 
 * @类功能说明： 餐桌服务类
 * @类修改者：  
 * @修改日期：  
 * @修改说明：  
 * @公司名称：ccit 
 * @作者：wanghao  
 * @创建时间：2016年11月5日 上午12:20:25  
 * @版本：V1.0
 */
public class DiningTableServers implements IDiningTableServers {
	private DiningTableDAO dtDao = null;

	public DiningTableServers() {
		dtDao = new DiningTableDAOimp();
	}

	@Override
	public boolean addDiningTable(DiningTable dt) {
		dt.setLastModfiyTime(dt.getLastModfiyTime());
		dt.setLastModfiyUid(dt.getCreatUid());
		dt.setLastModfiyUname(dt.getCreatUname());
		dt.setEnumType(BaseConstants.TABLESTATE);
		dt.setLocationEnumType(BaseConstants.TABLE_LOCATION_STATE);
		return dtDao.addDiningTable(dt);
	}

	@Override
	public boolean removeDiningTable(DiningTable dt) {
		return dtDao.removeDiningTable(dt);
	}

	@Override
	public boolean changeDiningTableInfo(DiningTable dt) {
		dt.setEnumType(BaseConstants.TABLESTATE);
		dt.setLocationEnumType(BaseConstants.TABLE_LOCATION_STATE);
		return dtDao.changeDiningTableInfo(dt);
	}

	@Override
	public List<DiningTable> getSomeDiningTables(int start, int limit) {
		return dtDao.getSomeDiningTables(start, limit) == null
				&& dtDao.getSomeDiningTables(start, limit).size() < 0 ? null
				: dtDao.getSomeDiningTables(start, limit);
	}

	@Override
	public DiningTable searchDiningTableByID(int id) {
		return dtDao.searchDiningTableByID(id);
	}

	@Override
	public DiningTable searchDiningTableByName(String name) {
		return dtDao.searchDiningTableByName(name);
	}

	@Override
	public boolean changeDiningTableState(DiningTable dt) {
		
		return dtDao.changeDiningTableState(dt);
	}

}
